//
//  QtbClientListener.h
//  AlianC
//
//  Created by fan on 2021/7/30.
//  Copyright © 2021 infobird. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <QtbClient/StateType.h>
typedef NS_ENUM(NSInteger, LoginType) {
    AgentANormal = 0,//A端座席（普通登录）
    AgentABindPhone = 1,//A端座席（绑电话登录）
    AgentCNormal = 7,//C端登录
    AgentCAnonymous = 99,//匿名c端登录
};

typedef NS_ENUM(NSInteger, TargetType) {
    CallAgent = 1,//呼叫坐席
    CallGateway,//呼叫语音网关（呼出到运营商）
    CallKeyWord,//呼叫关键字
    CallGroup,//呼叫业务组
};

typedef NS_ENUM(NSInteger, CallType) {
    Voice = 0,//语音呼叫
    Text = 1,//文本消息呼叫
    WeChat = 2,//微信呼叫
    Video = 4,//视频呼叫
};

@protocol QtbClientListenerDelegate <NSObject>

- (void)onConnect;
- (void)onDisconnect:(int)code;
- (void)onLoginSuccess;
- (void)onLoginError:(int)code desc:(NSString *)desc;
- (void)onLogoutSucces;
- (void)onLogoutError:(int)code desc:(NSString *)desc;
- (void)onForceLogout:(int)code desc:(NSString *)desc;

- (void)onCallIn:(NSString *)from callId:(NSString *)callId callType:(CallType)callType;
- (void)onTransferToMe:(NSString *)from callId:(NSString *)callId;//转移到我
- (void)onCalling:(NSString *)callId;  //正在外呼
- (void)onCallError:(int)errorCode desc:(NSString *)desc;//电话建立失败
- (void)onCallEstablished:(NSString *)other callID:(NSString *)callId; //到达对方,等待对方接听
- (void)onCallEstablishedReal:(NSString *)callId; //电话建立成功
- (void)onCallReleased:(NSString *)callID desc:(NSString *)desc;//电话断开成功

- (void)onQuestionBuild:(NSString *)other TargetType:(TargetType)targetType questionId:(NSString *)questionId;
- (void)onQuestionCancel:(NSString *)questionId;

//仅发起方
- (void)onQuestionCalling:(NSString *)questionId CallTo:(NSString *)callTo;
- (void)onQuestionError:(NSString *)questionId CallTo:(NSString *)callTo;

- (void)onStateChanged:(QtbStateType)state;

//发起三方通话结果
- (void)onStartConferenceSuccess;
- (void)onStartConferenceError:(int)code desc:(NSString *)desc;
//有人离开了三方会议
- (void)onOtherLeaveConference:(NSString *)otherSide;

- (void)onTimeOut:(NSString *)msg;
- (void)onMediaBuild:(NSString *)type desc:(NSString *)desc;//返回媒体建立的类型

@end
